package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.common.utils.uuid.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.LsLawyerMapper;
import com.ruoyi.system.domain.LsLawyer;
import com.ruoyi.system.service.ILsLawyerService;
import org.springframework.util.ObjectUtils;

/**
 * 律师Service业务层处理
 *
 * @author zhouyipeng
 * @date 2023-10-16
 */
@Service
public class LsLawyerServiceImpl implements ILsLawyerService {

    @Autowired
    private LsLawyerMapper lsLawyerMapper;

    /**
     * 查询律师
     *
     * @param id 律师主键
     * @return 律师
     */
    @Override
    public LsLawyer selectLsLawyerById(String id) {
        return lsLawyerMapper.selectLsLawyerById(id);
    }

    /**
     * 查询律师列表
     *
     * @param lsLawyer 律师
     * @return 律师
     */
    @Override
    public List<LsLawyer> selectLsLawyerList(LsLawyer lsLawyer) {

        List<LsLawyer> lsLawyers = lsLawyerMapper.selectLsLawyerList(lsLawyer);
        return lsLawyers;
    }
    @Override
    public List<LsLawyer> selectLsLawyerListFromC(LsLawyer lsLawyer) {

        List<LsLawyer> lsLawyers = lsLawyerMapper.selectLsLawyerImageListFromC(lsLawyer);
        return lsLawyers;
    }
    /**
     * 新增律师
     *
     * @param lsLawyer 律师
     * @return 结果
     */
    @Override
    public int insertLsLawyer(LsLawyer lsLawyer) {
        lsLawyer.setId(IdUtils.fastSimpleUUID());
        return lsLawyerMapper.insertLsLawyer(lsLawyer);
    }

    /**
     * 修改律师
     *
     * @param lsLawyer 律师
     * @return 结果
     */
    @Override
    public int updateLsLawyer(LsLawyer lsLawyer) {
        return lsLawyerMapper.updateLsLawyer(lsLawyer);
    }

    /**
     * 批量删除律师
     *
     * @param ids 需要删除的律师主键
     * @return 结果
     */
    @Override
    public int deleteLsLawyerByIds(String[] ids) {
        return lsLawyerMapper.deleteLsLawyerByIds(ids);
    }

    /**
     * 删除律师信息
     *
     * @param id 律师主键
     * @return 结果
     */
    @Override
    public int deleteLsLawyerById(String id) {
        return lsLawyerMapper.deleteLsLawyerById(id);
    }

    @Override
    public LsLawyer getDefault(String basePath) {
        LsLawyer aDefault = lsLawyerMapper.getDefault(basePath);
        return ObjectUtils.isEmpty(aDefault) ? null : aDefault;
    }
}
